﻿<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="GenericMethodInvokerSchema"
    targetNamespace="http://microsoft.com/mgsi/sunil/GenericMethodInvoker.xsd"
    elementFormDefault="qualified"
    xmlns="http://microsoft.com/mgsi/sunil/GenericMethodInvoker.xsd"
    xmlns:mstns="http://microsoft.com/mgsi/sunil/GenericMethodInvoker.xsd"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
  <xs:element name="scenarios">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="scenario" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:element name="scenario">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="objectInstance" maxOccurs="unbounded" minOccurs="1"/>
      </xs:sequence>
      <xs:attribute name="name" use="required" type="xs:string"></xs:attribute>
      <xs:attribute name="include" default="false" type="xs:boolean"></xs:attribute>
    </xs:complexType>
  </xs:element>

  <xs:element name="objectInstance">
    <xs:complexType>
      <xs:sequence maxOccurs="unbounded" minOccurs="0">
        <xs:group ref="initializeObject"></xs:group>
      </xs:sequence>
      <xs:attribute name="name" use="required" type="xs:string"></xs:attribute>
      <xs:attribute name="type" use="required" type="xs:string"></xs:attribute>
      <xs:attribute name="assembly" use="optional" type="xs:string"></xs:attribute>
      <xs:attribute name="value" use="optional" type="xs:string"></xs:attribute>
      <xs:attribute name="initializeThroughConstructor" use="optional" type="xs:boolean" default="false"></xs:attribute>
      <xs:attribute name="isStatic" use="optional" type="xs:boolean" default="false"></xs:attribute>
    </xs:complexType>
  </xs:element>

  <xs:element name="methodCall">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="iterationParameters" maxOccurs="unbounded" minOccurs="1"/>
      </xs:sequence>
      <xs:attribute name="name" use="required" type="xs:string"></xs:attribute>
      <xs:attribute name="include" default="false" type="xs:boolean"></xs:attribute>
    </xs:complexType>
  </xs:element>

  <xs:element name="iterationParameters">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="objectInstance" minOccurs="0" maxOccurs="unbounded"></xs:element>
      </xs:sequence>
      <xs:attribute name="repeatIterationCount" use="required" type="xs:integer"></xs:attribute>
      <xs:attribute name="culture" default="en-US" type="xs:string"></xs:attribute>
    </xs:complexType>
  </xs:element>

  <xs:element name="constructorParameters">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="objectInstance" maxOccurs="unbounded"></xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:element name="methods">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref ="methodCall" maxOccurs="unbounded" minOccurs ="0"></xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:element name="properties">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref ="objectInstance" minOccurs ="0" maxOccurs="unbounded"></xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <xs:group name="initializeObject">
    <xs:choice>
      <xs:element ref="methods" minOccurs="0"/>
      <xs:element ref="properties" minOccurs="0"/>
      <xs:element ref="constructorParameters" minOccurs="0"/>
    </xs:choice>
  </xs:group>
</xs:schema>
